#!/bin/bash

export TOOLS_DIR=$(dirname $0)
export PROJECT_DIR=$(dirname $TOOLS_DIR)
export APP_DIR=$PROJECT_DIR/src
export LIB_DIR=$APP_DIR/lib
export TESTS_DIR=$PROJECT_DIR/tests

if test "x$PYTHON" = "x"; then
  echo "Please set PYTHON environment variable." 1>&2
  exit 1
fi

if test "x$APPENGINE_DIR" = "x"; then
  echo "Please set APPENGINE_DIR environment variable." 1>&2
  exit 1
fi

export PYTHONPATH=\
"$APP_DIR":\
"$LIB_DIR":\
"$TESTS_DIR":\
"$TOOLS_DIR":\
"$APPENGINE_DIR":\
"$APPENGINE_DIR/lib/fancy_urllib":\
"$APPENGINE_DIR/lib/webob":\
"$APPENGINE_DIR/lib/yaml/lib"

$PYTHON $TESTS_DIR/server_tests.py "$@"
